// 
//  Copyright (C) 2004-2009  Autodesk, Inc.
//  
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of version 2.1 of the GNU Lesser
//  General Public License as published by the Free Software Foundation.
//  
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//  
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#ifndef _MAPINFOUPDATE_H_
#define _MAPINFOUPDATE_H_

#include "MapInfoFeatureCommand.h"


class MapInfoUpdate : public MapInfoFeatureCommand<FdoIUpdate>
{
    public:
        MAPINFO_API MapInfoUpdate(MapInfoConnection* connection) : MapInfoFeatureCommand<FdoIUpdate>(connection)
        {
            m_properties = FdoPropertyValueCollection::Create();
        }

    protected:
        MAPINFO_API virtual ~MapInfoUpdate()
        {
            FDO_SAFE_RELEASE(m_properties);
        }

    //-------------------------------------------------------
    // FdoIUpdate implementation
    //-------------------------------------------------------

    public:
        MAPINFO_API virtual FdoPropertyValueCollection* GetPropertyValues() { return FDO_SAFE_ADDREF(m_properties); }
        MAPINFO_API virtual FdoInt32 Execute()
        {
            // verify connection
            if (m_connection == NULL)
                throw FdoCommandException::Create(NlsMsgGetMain(FDO_NLSID(MAPINFOPROVIDER_NO_CONNECTION)));
            return m_connection->Update(m_className, m_filter, m_properties);
        }
        MAPINFO_API virtual FdoILockConflictReader* GetLockConflicts() { return NULL; }

    private:
        FdoPropertyValueCollection* m_properties;
};

#endif

